home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / cuj1008.zip / 1008129A < prev    next >
Text File  |  1992-06-09  |  887b  |  31 lines

  1.  
  2.    #include <stdio.h>
  3.    
  4.    struct s_node
  5.        {
  6.        struct s_node *next_node;
  7.        char *string_value;
  8.        };
  9.  
  10.    void main()   
  11.        {
  12.        /* Let's just do static initialization for now */
  13.        static struct s_node fourth_node = { NULL, "Four"};
  14.        static struct s_node third_node = {&fourth_node, "Three"};
  15.        static struct s_node second_node = {&third_node, "Second"};
  16.        static struct s_node first_node = {&second_node, "First"}; 
  17.        static struct s_node *root_node = &first_node;
  18.        static struct s_node *current_node = NULL;
  19.        int counter;
  20.  
  21.        /* Get to the third node */
  22.        current_node = root_node;
  23.        for (counter = 0; counter < 2; counter ++)
  24.            {
  25.            current_node = current_node->next_node;
  26.            }
  27.        printf("Third string value is %s", 
  28.            current_node->string_value);
  29.        }    
  30.  
  31.